package de.axone.webtemplate.validator.impl;

import java.util.Date;

import de.axone.webtemplate.validator.Validator;

public class CreditCardDateValidator implements Validator<Date> {
	
	//TODO: Da fehlt noch einiges. Vor allem Durchblick und eine Idee.
	
	private static final String TOO_OLD = "VALIDATOR_TOO_OLD";

	@Override
	public boolean isValid( Date value ) {
		
		return validate( value ) == null;
	}

	@Override
	public String validate( Date value ) {
		
		Date now = new Date();
		
		if( now.getTime() > value.getTime() ) return TOO_OLD;
		
		return null;
	}
	
	private YearValidator yearValidator = new YearValidator();
	private MonthValidator monthValidator = new MonthValidator( yearValidator );
	public Validator<Integer> getYearValidator(){
		
		return yearValidator;
	}
	public Validator<Integer> getMonthValidator(){
		
		return monthValidator;
	}
	
	class YearValidator implements Validator<Integer> {

		@Override
		public boolean isValid( Integer value ) {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public String validate( Integer value ) {
			// TODO Auto-generated method stub
			return null;
		}
		
	}
	
	class MonthValidator implements Validator<Integer> {
		
		YearValidator yearValidator;
		MonthValidator( YearValidator yearValidator ){
		}

		@Override
		public boolean isValid( Integer value ) {
			// TODO Auto-generated method stub
			return false;
		}

		@Override
		public String validate( Integer value ) {
			// TODO Auto-generated method stub
			return null;
		}
		
	}

}
